#include "SectorMap.h"

SectorMap::SectorMap()
{
	InitializeNodes();
}

SectorMap::~SectorMap()
{

}

void SectorMap::InitializeNodes(void)
{
	for (int i = 0; i < gGridSize; i++)
	{
		for (int j = 0; j < gGridSize; j++)
		{
			Subsector* subsector = new Subsector;
			subsector->SetCoordinate(i, j);
			mNodeList[i][j] = subsector;
		}
	}
}

// set the current object to the given coordinate
void SectorMap::SetObject(GameObject* obj, Coordinate coord)
{
	((Subsector*)mNodeList[coord.x][coord.y])->SetGameObject(obj);
}

void SectorMap::SetObject(GameObject* obj, int x, int y)
{
	((Subsector*)mNodeList[x][y])->SetGameObject(obj);
}

// clears all info
void SectorMap::ClearAll(void)
{
	for(int i = 0; i < gGridSize; i++)
	{
		for (int j = 0; j < gGridSize; j++)
		{
			((Subsector*)mNodeList[i][j])->DestroyGameObject();
		}
	}
}

// deletes object from the current coordinate
void SectorMap::DeleteObject(Coordinate c)
{
	((Subsector*)mNodeList[c.x][c.y])->DestroyGameObject();
}